import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect:'/home',
    children: [
      {
        path: '/home',
        name: 'homeIndex',
        component: () => import('@/views/activity/home/homeIndex.vue'),
        meta: {
          title: '首页'
        }
      },
      {
        path: '/level_new',
        name: 'level_new',
        component: () => import('@/views/activity/level_new/LevelNew.vue'),
        meta: {
          title: '我的会员'
        }
      },
      {
        path: '/agreement',
        name: 'agreement',
        component: () => import('@/views/constant/agreement/AgreementIndex.vue'),
        meta: {
          title: '用户协议'
        }
      },
      {
        path: '/privacy',
        name: 'privacy',
        component: () => import('@/views/constant/privacy2/Privacy2Component.vue'),
        meta: {
          title: '隐私协议'
        }
      },
      {
        path: '/rechargeProtocol',
        name: 'rechargeProtocol',
        component: () => import('@/views/constant/rechargeProtocol/RechargeProtocol.vue'),
        meta: {
          title: '充值服务协议'
        }
      },
      {
        path: '/convention_new',
        name: 'convention_new',
        component: () => import('@/views/constant/convention_new/ConventionNew.vue'),
        meta: {
          title: '绿色公约'
        }
      },
      {
        path: '/down',
        name: 'down',
        component: () => import('@/views/constant/down/DownComponent.vue'),
        meta: {
          title: '声贝'
        }
      },
      {
        path: '/down_new',
        name: 'down_new',
        component: () => import('@/views/constant/down_new/DownNew.vue'),
        meta: {
          title: '声贝'
        }
      },
      {
        path: '/coop',
        name: 'coop',
        component: () => import('@/views/constant/coop/CoopComponent.vue'),
        meta: {
          title: '联系我们'
        }
      },
      {
        path: '/luckyBox',
        name: 'luckyBox',
        component: () => import('@/views/activity/lucky_box/LuckyBox.vue'),
        meta: {
          title: '幸运魔盒'
        }
      },
      {
        path: '/playrules',
        name: 'playrules',
        component: () => import('@/views/constant/playrules/PlayRules.vue'),
        meta: {
          title: '玩法规则'
        }
      },
      {
        path: '/dressUpExchange',
        name: 'dressUpExchange',
        component: () => import('@/views/constant/dressUpExchange/DressUpExchange.vue'),
        meta: {
          title: '装扮兑换 礼物兑换'
        }
      },
      {
        path: '/exchangeRecord',
        name: 'exchangeRecord',
        component: () => import('@/views/constant/exchangeRecord/ExchangeRecord.vue'),
        meta: {
          title: '兑换记录'
        }
      },
      {
        path: '/followFriends',
        name: 'followFriends',
        component: () => import('@/views/constant/followFriends/FollowFriends.vue'),
        meta: {
          title: '好友列表'
        }
      },
      {
        path: '/PlatformProtocol',
        name: 'PlatformProtocol',
        component: () => import('@/views/recharge/platformProtocol/PlatformProtocol.vue'),
        meta: {
          title: '提现协议'
        }
      },
      {
        path: '/OnePiece',
        name: 'OnePiece',
        component: () => import('@/views/constant/onePiece/OnePiece.vue'),
        meta: {
          title: '闪耀新星'
        }
      },
      {
        path: '/ObtainShells',
        name: 'ObtainShells',
        component: () => import('@/views/activity/obtain_shells/ObtainShells.vue'),
        meta: {
          title: '签到赢荣耀典藏皮肤'
        }
      },
      {
        path: '/SignIn_new',
        name: 'SignIn_new',
        component: () => import('@/views/activity/signIn_new/SignInNew.vue'),
        meta: {
          title: '达仁堂得特权'
        }
      },
      {
        path: '/goodVoice',
        name: 'goodVoice',
        component: () => import('@/views/activity/good_voice/GoodVoice.vue'),
        meta: {
          title: '好声音'
        }
      },
      {
        path: '/OfficialCertification',
        name: 'OfficialCertification',
        component: () => import('@/views/constant/official_certification/OfficialCertification.vue'),
        meta: {
          title: '官方认证'
        }
      },
      {
        path: '/Notice',
        name: 'Notice',
        component: () => import('@/views/constant/notice/NoticeComponent.vue'),
        meta: {
          title: '声贝防网络诈骗公告'
        }
      },
      {
        path: '/login',
        name: 'login',
        component: () => import('@/views/recharge/login/LoginComponent.vue'),
        meta: {
          title: '登录'
        }
      },
      {
        path: '/exchange',
        name: 'exchange',
        component: () => import('@/views/recharge/exchange/ExchangeComponent.vue'),
        meta: {
          title: '登录'
        }
      },
      {
        path: '/withdrawal',
        name: 'withdrawal',
        component: () => import('@/views/recharge/withdrawal/WithdrawalComponent.vue'),
        meta: {
          title: '提现'
        }
      },
      {
        path: '/hope_new',
        name: 'hope_new',
        component: () => import('@/views/constant/hope_new/HopeNew.vue'),
        meta: {
          title: '首冲得限定装扮'
        }
      },
      {
        path: '/withdrawal_new',
        name: 'withdrawal_new',
        component: () => import('@/views/recharge/withdrawal_new/WithdrawalNew.vue'),
        meta: {
          title: '提现'
        }
      },
      {
        path: '/withdrawal_push',
        name: 'withdrawal_push',
        component: () => import('@/views/recharge/withdrawal_push/WithdrawalPush.vue'),
        meta: {
          title: '添加银行卡号'
        }
      },
      {
        path: '/recharge_wx_shande',
        name: 'recharge_wx_shande',
        component: () => import('@/views/recharge/recharge_wx_shande/RechargeWxShande.vue'),
        meta: {
          title: '公众号充值'
        }
      },
      {
        path: '/recharge_wx',
        name: 'recharge_wx',
        component: () => import('@/views/recharge/recharge_wx_shande/RechargeWxShande.vue'),
        meta: {
          title: '公众号充值'
        }
      },
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})


router.beforeEach((to, from, next) => {
  (window as any).document.title = to.meta.title ? to.meta.title : ''
  next()
})

export default router
